<template>
  <div>
    <!-- 
        图片前缀：开发环境（8080） 要加 'http://localhost:2000'
                生产环境(2000)  不加'http://localhost:2000'
     -->
    
    <van-swipe class="my-swipe" :autoplay="1000" indicator-color="white">
      <van-swipe-item v-for="item in arr" :key="item.id">
        <img :src="$pre + item.img" alt="">
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { reqhomebanner } from "../../../http/http";
export default {
  data() {
    return {
      // 1.初始化数据
      arr: [],
    };
  },
  mounted() {
    // 2.发请求
    reqhomebanner().then((res) => {
      // console.log(res);
      this.arr = res.data.list;
    });
  },
};
</script>

<style lang="less" scoped>
@import "../../../less/index.less";
.my-swipe{
    height: 3.8rem;
}
img {
  width: 100%;
  height: 100%;
}
</style>